package com.ruoyi.web.controller.basedata;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.basedata.domain.TerminalsFreezeXbWcView;
import com.ruoyi.basedata.service.ITerminalsFreezeXbWcViewService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 小表未抄回数据视图Controller
 *
 * @author gdqt
 * @date 2024-04-03
 */
@RestController
@RequestMapping("/basedata/terminalsFreezeXbWcView")
public class TerminalsFreezeXbWcViewController extends BaseController {
    @Autowired
    private ITerminalsFreezeXbWcViewService terminalsFreezeXbWcViewService;

    /**
     * 查询小表未抄回数据视图列表
     */
    @PreAuthorize("@ss.hasAnyPermi('basedata:terminalsFreezeXbWcView:list,analysis:meter:readingrate')")
    @PostMapping("/listMissingTerminalsFreezeXb")
    public TableDataInfo listMissingTerminalsFreezeXb(@RequestBody TerminalsFreezeXbWcView terminalsFreezeXbWcView) {
        startPage();
        List<TerminalsFreezeXbWcView> list = terminalsFreezeXbWcViewService.listMissingTerminalsFreezeXb(terminalsFreezeXbWcView);
        return getDataTable(list);
    }

    /**
     * 导出小表未抄回数据视图列表
     */
    @PreAuthorize("@ss.hasAnyPermi('basedata:terminalsFreezeXbWcView:export,analysis:meter:readingrate')")
    @Log(title = "小表未抄回数据视图", businessType = BusinessType.EXPORT)
    @PostMapping("/exportMissing")
    public void exportMissing(HttpServletResponse response,TerminalsFreezeXbWcView terminalsFreezeXbWcView) {
        List<TerminalsFreezeXbWcView> list = terminalsFreezeXbWcViewService.listMissingTerminalsFreezeXb(terminalsFreezeXbWcView);
        ExcelUtil<TerminalsFreezeXbWcView> util = new ExcelUtil<TerminalsFreezeXbWcView>(TerminalsFreezeXbWcView.class);
        util.exportExcel(response, list, "小表未抄回数据");
    }

    /**
     * 查询小表未抄回数据视图列表
     */
    @PreAuthorize("@ss.hasPermi('basedata:terminalsFreezeXbWcView:list')")
    @GetMapping("/list")
    public TableDataInfo list(TerminalsFreezeXbWcView terminalsFreezeXbWcView) {
        startPage();
        List<TerminalsFreezeXbWcView> list = terminalsFreezeXbWcViewService.selectTerminalsFreezeXbWcViewList(terminalsFreezeXbWcView);
        return getDataTable(list);
    }

    /**
     * 导出小表未抄回数据视图列表
     */
    @PreAuthorize("@ss.hasPermi('basedata:terminalsFreezeXbWcView:export')")
    @Log(title = "小表未抄回数据视图", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TerminalsFreezeXbWcView terminalsFreezeXbWcView) {
        List<TerminalsFreezeXbWcView> list = terminalsFreezeXbWcViewService.selectTerminalsFreezeXbWcViewList(terminalsFreezeXbWcView);
        ExcelUtil<TerminalsFreezeXbWcView> util = new ExcelUtil<TerminalsFreezeXbWcView>(TerminalsFreezeXbWcView.class);
        util.exportExcel(response, list, "小表未抄回数据视图数据");
    }

    /**
     * 获取小表未抄回数据视图详细信息
     */
    @PreAuthorize("@ss.hasPermi('basedata:terminalsFreezeXbWcView:query')")
    @GetMapping(value = "/{tenantId}")
    public AjaxResult getInfo(@PathVariable("tenantId") String tenantId) {
        return success(terminalsFreezeXbWcViewService.selectTerminalsFreezeXbWcViewByTenantId(tenantId));
    }

    /**
     * 新增小表未抄回数据视图
     */
    @PreAuthorize("@ss.hasPermi('basedata:terminalsFreezeXbWcView:add')")
    @Log(title = "小表未抄回数据视图", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TerminalsFreezeXbWcView terminalsFreezeXbWcView) {
        return toAjax(terminalsFreezeXbWcViewService.insertTerminalsFreezeXbWcView(terminalsFreezeXbWcView));
    }

    /**
     * 修改小表未抄回数据视图
     */
    @PreAuthorize("@ss.hasPermi('basedata:terminalsFreezeXbWcView:edit')")
    @Log(title = "小表未抄回数据视图", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TerminalsFreezeXbWcView terminalsFreezeXbWcView) {
        return toAjax(terminalsFreezeXbWcViewService.updateTerminalsFreezeXbWcView(terminalsFreezeXbWcView));
    }

    /**
     * 删除小表未抄回数据视图
     */
    @PreAuthorize("@ss.hasPermi('basedata:terminalsFreezeXbWcView:remove')")
    @Log(title = "小表未抄回数据视图", businessType = BusinessType.DELETE)
    @DeleteMapping("/{tenantIds}")
    public AjaxResult remove(@PathVariable String[] tenantIds) {
        return toAjax(terminalsFreezeXbWcViewService.deleteTerminalsFreezeXbWcViewByTenantIds(tenantIds));
    }
}
